<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

    <script>

        // 创建 axios
        var instance = axios.create({
            baseURL: 'https://localhost:8080'
        });
        function request() {
            console.log("请求开始...")
            instance.get('/hi')
                .then(function (response) {
                    console.log(response);
                })
                .catch(function (error) {
                    console.log(error);
                });
        }
    </script>
</head>

<body>

    <div>
        <button onclick="request()">请求数据</button>
    </div>

</body>

</html>